/*

Author   : chaos

FileName : ass_era.cpp

Date     : 16/08/17 16:55:08

*/
#include <iostream>
#include <string>

using namespace std;

int main(int argc ,char *argv[])
{
    string s1,s2;

    s1 = "string";

    s2.assign(s1);
    cout << "Assign string " << endl << "s1 :";
    cout << s1 << " s2 : " << s2 << endl;

    s2.insert(0,"This isn't a ");
    cout << "Insert string to s2 .. " << endl;
    cout << "s1 :" << s1 << "s2 :" << endl;

    s2.insert(0,"This isn't a");
    cout << "Inset string to s2..." << endl;
    cout << "s2 :" << s2 << endl;

    s2.swap(s1);
    cout << "Swap s1 and s2 .. " << endl;
    cout << "s1 :" << s1 << " s2 : " << s2 << endl;

    s1.erase(7,3);
    cout <<"Erase \"n't\" from s1 ..." << endl;
    cout << "s1 :" << s1 << endl;

    s1[2] = 'I';
    cout << "Set s1[2] = 'I'..." << endl;
    cout << "s1 : " << s1 << endl;

    cout << "Get substing ..." << endl;
    cout << "s1[4-5] :" << s1.substr(5,2) << endl;



    return 0;
}
